From: Daniel Boles Date: Fri, 24 Feb 2017 22:46:05 +0000 (+0000) Subject: ScrolledWindow: Don’t req size for autohidden bars X-Git-Tag: archive/raspbian/3.24.39-1+rpi1~1^2~65^2~39^2~512 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=fcfad2dd7eaa881efa038ad6448990bba98b8fcd;p=gtk%2B3.0.git ScrolledWindow: Don’t req size for autohidden bars POLICY_AUTOMATIC means scrollbars are only shown when needed, i.e. when the size of the window is not large enough to show the entire child. So when measuring the preferred size, such scrollbars should be ignored. But measure() added size for *any* non-overlay scrollbar of the opposite orientation, e.g. for horizontal size, it added the width of vscrollbar. So we requested for child + bar, & having enough for child meant that the policy hid the bar, leaving extra space empty below/right of the child. Fix this by only adding size for such bars if they use POLICY_ALWAYS. https://bugzilla.gnome.org/show_bug.cgi?id=778853 --- diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 51b90860f0..b68fd96b2f 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -1880,7 +1880,7 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget, minimum_req.width = MAX (minimum_req.width, hscrollbar_requisition.width + sborder.left + sborder.right); natural_req.width = MAX (natural_req.width, hscrollbar_requisition.width + sborder.left + sborder.right); - if (!priv->use_indicators) + if (!priv->use_indicators && priv->hscrollbar_policy == GTK_POLICY_ALWAYS) { minimum_req.height += scrollbar_spacing + hscrollbar_requisition.height; natural_req.height += scrollbar_spacing + hscrollbar_requisition.height; @@ -1892,7 +1892,7 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget, minimum_req.height = MAX (minimum_req.height, vscrollbar_requisition.height + sborder.top + sborder.bottom); natural_req.height = MAX (natural_req.height, vscrollbar_requisition.height + sborder.top + sborder.bottom); - if (!priv->use_indicators) + if (!priv->use_indicators && priv->vscrollbar_policy == GTK_POLICY_ALWAYS) { minimum_req.width += scrollbar_spacing + vscrollbar_requisition.width; natural_req.width += scrollbar_spacing + vscrollbar_requisition.width;